<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
    <h2 class="sub-header">编辑联系人</h2>
    <div class="table-responsive">
        <form #f="ngForm" (ngSubmit)="updateHandle(f)">
            <div class="form-group">
                <label for="name">姓名</label>
                <input type="text" name="name" required class="form-control" id="name" placeholder="姓名" [(ngModel)]="contact.name">
            </div>
            <div class="form-group">
                <label for="email">邮箱</label>
                <input type="email" name="email" required class="form-control" id="email" placeholder="邮箱" [(ngModel)]="contact.email">
            </div>
            <div class="form-group">
                <label for="tel">电话</label>
                <input maxlength="11" type="tel" name="tel" required class="form-control" id="tel" placeholder="电话" [(ngModel)]="contact.tel">
            </div>
            <div class="form-group">
                <label for="tagId">标签</label>
                <select [(ngModel)]="contact.tagId" name="tagId" id="tagId" required class="form-control">
                    <ng-template ngFor [ngForOf]="tagList" let-item >
                        <option [value]="item.id">{{item.name}}</option>
                        <!-- 手动处理选中对应option -->
                        <!-- 
                        <option [value]="item.id" *ngIf="item.id==contact.tagId;else elseOption" selected="selected">{{item.name}}</option>
                        <ng-template #elseOption>
                            <option [value]="item.id">{{item.name}}</option>
                        </ng-template> -->
                    </ng-template>
                </select>
            </div>
            <button type="submit" class="btn btn-info">确认修改</button>
        </form>
    </div>
</div>